#pragma once
#include "GamePart.h"
#include <list>


namespace _DATAPART_
{
	namespace _GAME_
	{
		//ObjectiveTracker 
		class Objective:
			public GamePart
		{
		public:
			enum eObjectiveType
			{
				eOT_Primary,
				eOT_Secondary,
				eOT_Bonus,
				eOT_Count
			};
			enum eObjectiveStateType
			{
				eOST_Inactive,
				eOST_Active,
				eOST_Success,
				eOST_Fail,
				eOST_Count
			};

			
			Objective(void);
			~Objective(void);

			void Update(float elapsedtime);
			
			void AddObjective(Objective* ob,bool startActive = false);

			eObjectiveStateType GetState()
			{
				return m_eObjectiveStateType;
			}
			eObjectiveType GetType()
			{
				return m_eObjectiveType;
			}
			
			

		protected:
			virtual void Trigger(_P_GAME::GamePart* Instigator);
			
			std::list<Objective*> m_ActivedSubObjectives;
			std::list<Objective*> m_InactivedSubObjectives;
			std::list<Objective*> m_FailedSubObjectives;
			std::list<Objective*> m_SuccessedSubObjectives;

			_FO_UTIL::Name m_nameSuccessTrigger;
			_FO_UTIL::Name m_nameFailTrigger;
			_FO_UTIL::Name m_nameActiveTrigger;

			_FOGGE_::foString m_strObjectiveExplaine;
			
			std::queue<_FO_UTIL::Name> m_queueActivateSubObjectives;//!< the list of name of subobjectives that need to activated when a this objective is activated,

			_M_GAME::Condition* m_ptrConditionSuccess;
			_M_GAME::Condition* m_ptrConditionFail;
			
			

		private:
			
			eObjectiveType m_eObjectiveType;

			eObjectiveStateType m_eObjectiveStateType;

			_FOGGE_::foUInt m_uiPrimaryObjectuveCount;//!< to check this obj is success or inprogress

			

		};
	}
}